home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12162 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: isonews.bbn.hp.com!hpbblb!news
  2. From: Matthias Dittrich <matti>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is there a problem using memset on a malloc'd memory in HP-C
  5. Date: 29 Mar 1996 09:01:50 GMT
  6. Organization: Hewlett-Packard Co.
  7. Message-ID: <4jg8tu$h4r@hpbblb.bbn.hp.com>
  8. References: <31a7cc$10b20.32c@NEWS>
  9. NNTP-Posting-Host: trabant.bbn.hp.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.07 9000/712)
  14. X-URL: news:31a7cc$10b20.32c@NEWS
  15.  
  16. jul395@prb.mhs.compuserve.com (Jonathan Julian) wrote:
  17. >I have searched your FAQ and found no reference to this problem.
  18. >
  19. >I am having trouble doing a malloc on memory that I allocated via
  20. >malloc.  I malloc'd the memory, memset it  and immediately look at it
  21. >and it is garbage.  I have changed my mallocs to callocs, but later in
  22. >my code I realloc.  Since realloc does not initialize and I
  23. >distrusting of memset I have written a loop to initialize my memory.
  24. >
  25. >The structure that I am trying to initialize is an array of pointers
  26. >to pointers that I would initially like to be NULL.  I am on HP
  27. >a.09.07  using HP-C
  28. >.....
  29. I'm also working on this system and I don't know about any problems. Are you
  30. sure to have initialized the complete memory ? It should be
  31. number_of_pointers * sizeof(your_pointer).
  32.  
  33. Good luck,
  34. Matthias
  35.  
  36.